package com.zjpg.forum.config;

import org.springframework.boot.system.ApplicationHome;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 本地资源
        registry.addResourceHandler("/image/**").addResourceLocations("file:E:\\IDEACache\\java_test\\2024\\forum" +
                "\\myforum\\target\\classes\\static\\image\\");

        // 上线项目资源
        //registry.addResourceHandler("/image/**").addResourceLocations("file:/root/forum02/classes/static/image/");
    }
}
